home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / A.D. Software / OOFILE / Buildable, limited OOFILE / samples / ooftst14.cpp < prev    next >
C/C++ Source or Header  |  1996-03-29  |  2KB  |  67 lines

  1. // Copyright 1995 A.D. Software. All Rights Reserved
  2.  
  3. // OOFTEST14 - Mixture of OOFTest1 and 4 with HTML Reports
  4.  
  5. // Simple stream I/O is used to interact with the user.
  6. #include "oofile.hpp"
  7. #include "oofhtml.hpp"
  8. #include "ooftst01.inc"
  9.  
  10. int main()
  11. {
  12.     cout << "OOFILE Validation Suite - Test HTML\n"
  13.          << "Simple test of the HTML Report Writer\n";
  14.     
  15.     dbConnect_ctree    theDB;
  16.     dbPeople     People;
  17.  
  18.     theDB.useSeparateFiles();  // note the blank connection names!
  19. // this test creates People.dat, People.idx & Blobs
  20.     
  21.     if (dbConnect::fileExists("People.dat"))
  22.         theDB.openConnection("");
  23.     else {
  24.         theDB.newConnection("");
  25.         People.AddTestData();
  26.     }
  27.     People.setSortOrder(People.LastName);
  28.     
  29.     cout << "This test produces the columnar and pagewise reports in two variants," << endl
  30.     << "first using plain HTML then using the Netscape tables" << endl << endl    
  31.     << "Producing simple HTML Columnar report to oofts14a.htm...";
  32.     
  33.     dbView theView(People); 
  34.     theView << People.LastName << People.OtherNames << People.Description; 
  35.  
  36.     ofstream fs("oofts14a.htm");
  37.     dbRepHTML tempReport(dbRepSizer("Demo Columnar Report").pageHeight(80),
  38.                     dbRepColWidths() << 10 << 15 << 50, theView);
  39.     tempReport.draw(fs);
  40.     fs.close();
  41.     
  42.      cout << endl << "Creating a PageWise report to oofts14b.htm"<< endl;    
  43.     ofstream fs2("oofts14b.htm");
  44.     dbRepHTML tempReport2(dbRepSizer("Demo Page-wise Report").pageHeight(80),
  45.                      dbRepColWidths() << 15 << 60,theView, dbRep::pageWise);
  46.     tempReport2.draw(fs2);
  47.     fs2.close();
  48.     
  49.  
  50.      cout << endl << "Creating a Columnar report to oofts14c.htm"<< endl;
  51.     ofstream fs3("oofts14c.htm");
  52.     dbRepHTMLTable tempReport3(dbRepSizer("Demo Columnar Report").pageHeight(80),
  53.                     dbRepColWidths() << 10 << 15 << 50, theView);
  54.     tempReport3.draw(fs3);
  55.      fs3.close();
  56.     
  57.      cout << endl << "Creating a PageWise report to oofts14d.htm"<< endl;
  58.         ofstream fs4("oofts14d.htm");
  59.     dbRepHTMLTable tempReport4(dbRepSizer("Demo Page-wise Report").pageHeight(80),
  60.                      dbRepColWidths() << 15 << 60,theView, dbRep::pageWise);
  61.     tempReport4.draw(fs4);
  62.      fs4.close();
  63.     
  64.     cout << "done" << endl;
  65.  
  66.     return EXIT_SUCCESS;
  67. }